/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package app.controller;

import app.business.EventSessionBean;
import app.entity.Events;
import java.util.List;
import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;

/**
 *
 * @author DangThanh
 */
@ManagedBean(name = "eventManagedBean")
@SessionScoped
public class EventManagedBean {

    @EJB
    private EventSessionBean eventSessionBean;
    private Events event;

    public Events getEvent() {
        return event;
    }

    public void setEvent(Events event) {
        this.event = event;
    }

    /**
     * Creates a new instance of EventManagedBean
     */
    public EventManagedBean() {
        event = new Events();
    }

    public List<Events> getEvents() {
        return eventSessionBean.getAllEvents();
    }

    public void addEvent() {
        event = eventSessionBean.addEvent(event);
    }
}
